﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace CDStore3Tiers
{
    public static class getConfig
    {
        public static string getConnection()
        {
            FileStream file = new FileStream(System.IO.Directory.GetCurrentDirectory().ToString()
                + "\\conFiguration.txt", FileMode.Open, FileAccess.Read);
            StreamReader r = new StreamReader(file);
            string cn = r.ReadLine();
            r.Close();
            file.Close();
            return cn;
        }

        public static void ghiFileConfig(string serVer, string db)
        {
            FileStream file = new FileStream(System.IO.Directory.GetCurrentDirectory().ToString() + "\\conFiguration.txt", FileMode.OpenOrCreate, FileAccess.Write);
            StreamWriter wr = new StreamWriter(file);
            wr.WriteLine(@"Data Source=" + serVer + ";Initial Catalog=" + db + ";Integrated Security=True");

            wr.Close();
            file.Close();
        }
    }

}
